import 'dart:convert' show json;

import 'package:flutter_common_app/data/protection.dart';

class ProfileData {
  ProfileData({
    this.userId,
    this.userType,
    this.nickname,
    this.avatarImgId,
    this.avatarUrl,
    this.backgroundImgId,
    this.backgroundUrl,
    this.signature,
    this.createTime,
    this.userName,
    this.accountType,
    this.shortUserName,
    this.birthday,
    this.authority,
    this.gender,
    this.accountStatus,
    this.province,
    this.city,
    this.authStatus,
    this.description,
    this.detailDescription,
    this.defaultAvatar,
    this.expertTags,
    this.experts,
    this.djStatus,
    this.locationStatus,
    this.vipType,
    this.followed,
    this.mutual,
    this.authenticated,
    this.lastLoginTime,
    this.lastLoginIP,
    this.remarkName,
    this.viptypeVersion,
    this.authenticationTypes,
    this.avatarDetail,
    this.anchor,
  });

  factory ProfileData.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : ProfileData(
    userId: asT<int>(jsonRes['userId']),
    userType: asT<int>(jsonRes['userType']),
    nickname: asT<String>(jsonRes['nickname']),
    avatarImgId: asT<int>(jsonRes['avatarImgId']),
    avatarUrl: asT<String>(jsonRes['avatarUrl']),
    backgroundImgId: asT<int>(jsonRes['backgroundImgId']),
    backgroundUrl: asT<String>(jsonRes['backgroundUrl']),
    signature: asT<String>(jsonRes['signature']),
    createTime: asT<int>(jsonRes['createTime']),
    userName: asT<String>(jsonRes['userName']),
    accountType: asT<int>(jsonRes['accountType']),
    shortUserName: asT<String>(jsonRes['shortUserName']),
    birthday: asT<int>(jsonRes['birthday']),
    authority: asT<int>(jsonRes['authority']),
    gender: asT<int>(jsonRes['gender']),
    accountStatus: asT<int>(jsonRes['accountStatus']),
    province: asT<int>(jsonRes['province']),
    city: asT<int>(jsonRes['city']),
    authStatus: asT<int>(jsonRes['authStatus']),
    description: asT<Object>(jsonRes['description']),
    detailDescription: asT<Object>(jsonRes['detailDescription']),
    defaultAvatar: asT<bool>(jsonRes['defaultAvatar']),
    expertTags: asT<Object>(jsonRes['expertTags']),
    experts: asT<Object>(jsonRes['experts']),
    djStatus: asT<int>(jsonRes['djStatus']),
    locationStatus: asT<int>(jsonRes['locationStatus']),
    vipType: asT<int>(jsonRes['vipType']),
    followed: asT<bool>(jsonRes['followed']),
    mutual: asT<bool>(jsonRes['mutual']),
    authenticated: asT<bool>(jsonRes['authenticated']),
    lastLoginTime: asT<int>(jsonRes['lastLoginTime']),
    lastLoginIP: asT<String>(jsonRes['lastLoginIP']),
    remarkName: asT<Object>(jsonRes['remarkName']),
    viptypeVersion: asT<int>(jsonRes['viptypeVersion']),
    authenticationTypes: asT<int>(jsonRes['authenticationTypes']),
    avatarDetail: asT<Object>(jsonRes['avatarDetail']),
    anchor: asT<bool>(jsonRes['anchor']),
  );

  int userId;
  int userType;
  String nickname;
  int avatarImgId;
  String avatarUrl;
  int backgroundImgId;
  String backgroundUrl;
  String signature;
  int createTime;
  String userName;
  int accountType;
  String shortUserName;
  int birthday;
  int authority;
  int gender;
  int accountStatus;
  int province;
  int city;
  int authStatus;
  Object description;
  Object detailDescription;
  bool defaultAvatar;
  Object expertTags;
  Object experts;
  int djStatus;
  int locationStatus;
  int vipType;
  bool followed;
  bool mutual;
  bool authenticated;
  int lastLoginTime;
  String lastLoginIP;
  Object remarkName;
  int viptypeVersion;
  int authenticationTypes;
  Object avatarDetail;
  bool anchor;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'userId': userId,
    'userType': userType,
    'nickname': nickname,
    'avatarImgId': avatarImgId,
    'avatarUrl': avatarUrl,
    'backgroundImgId': backgroundImgId,
    'backgroundUrl': backgroundUrl,
    'signature': signature,
    'createTime': createTime,
    'userName': userName,
    'accountType': accountType,
    'shortUserName': shortUserName,
    'birthday': birthday,
    'authority': authority,
    'gender': gender,
    'accountStatus': accountStatus,
    'province': province,
    'city': city,
    'authStatus': authStatus,
    'description': description,
    'detailDescription': detailDescription,
    'defaultAvatar': defaultAvatar,
    'expertTags': expertTags,
    'experts': experts,
    'djStatus': djStatus,
    'locationStatus': locationStatus,
    'vipType': vipType,
    'followed': followed,
    'mutual': mutual,
    'authenticated': authenticated,
    'lastLoginTime': lastLoginTime,
    'lastLoginIP': lastLoginIP,
    'remarkName': remarkName,
    'viptypeVersion': viptypeVersion,
    'authenticationTypes': authenticationTypes,
    'avatarDetail': avatarDetail,
    'anchor': anchor,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}
